package com.meng.system.security;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * @author: Xu Meng
 * @program: minions-cloud
 * @create: 2021-01-27 17:54
 **/
@Getter
@Setter
@Accessors(chain = true)
public class MiniUserDetails implements UserDetails {

    private static final long serialVersionUID = -5609775949610326044L;
    private String loginType;
    private Long userId;
    private String username;
    private String password;
    private Collection<? extends GrantedAuthority> authorities;

    public MiniUserDetails(){

    }

    public MiniUserDetails(String loginType, Long userId, String username, String password, Collection<? extends GrantedAuthority> authorities) {
        this.loginType = loginType;
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.authorities = authorities;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
